import http from "@/api";
import { CarManage, CarDeposit, UsageFee } from "@/api/interface/city/car";

// 车辆管理
// 获取车辆列表
export const getCarListAPI = (params: CarManage.SearchParams) => {
  return http.get<CarManage.Row[]>("/manager/vehicle", params);
};
// 获取车辆详情
export const getCarDetailAPI = (id: number) => {
  return http.get<CarManage.DetailData>(`/manager/vehicle/${id}`);
};

// 车辆押金管理
// 获取押金列表
export const getDepositListAPI = (params: { province: string; city: string }) => {
  return http.get<CarDeposit.Datum[]>("/manager/vehicle/deposit", params);
};
// 添加押金
export const addDepositAPI = (data: CarDeposit.Add) => {
  return http.post<CarDeposit.Datum>("/manager/vehicle/deposit", data);
};
// 修改押金
export const updateDepositAPI = (data: { id: number; deposit: number }) => {
  return http.put<CarDeposit.Datum>(`/manager/vehicle/deposit`, data);
};
// 删除押金
export const deleteDepositAPI = (ids: number) => {
  return http.delete<any>(`/manager/vehicle/deposit/${ids}`);
};

// 车辆使用费列表
// 获取车辆使用费
export const getUsageListAPI = (params: { province: string; city: string }) => {
  return http.get<UsageFee.Datum[]>("/manager/vehicle/usageFee", params);
};
// 添加车辆使用费
export const addUsageAPI = (data: UsageFee.AddParams) => {
  return http.post("/manager/vehicle/usageFee", data);
};
// 修改车辆使用费
export const updateUsageAPI = (data: { id: number; usageFee: number }) => {
  return http.put("/manager/vehicle/usageFee", data);
};
// 删除车辆使用费
export const deleteUsageAPI = (ids: number) => {
  return http.delete(`/manager/vehicle/usageFee/${ids}`);
};
